package de.axone.client;

import java.net.MalformedURLException;
import java.net.URL;

import de.axone.wash.DefaultWash;
import de.axone.wash.Wash;
import de.axone.wash.Wash.Type;
import de.axone.wash.Wash.WashException;
import de.axone.wash.client.WashClient;


public class MyClient extends WashClient {
	
	public static final void main( String args[] ) throws Exception {
		
		MyClient client = new MyClient();
		
		client.test();
	}
	
	public MyClient() throws MalformedURLException {
		
		super( new URL( "http://search.axon-e.de/Search/Search" ) );
	}
	
	public void test() {
		
		Wash wash = new DefaultWash();
		
		try {
			wash.addField( "uid", Type.INTEGER, 1001 );
			wash.addField( "key", Type.STRING, "7dfaf467a1eef04dc52555b7e2f31eed" );
			wash.addField( "start", Type.INTEGER, 0 );
			wash.addField( "maxResults", Type.INTEGER, 10 );
			wash.addField( "q", Type.STRING, "Kindergarten" );
			
			Wash result = call( "search", "search", wash );
			
			System.out.println( result.serialize() );
			
		} catch( WashException e ) {
			e.printStackTrace();
		} catch( ClientException e2 ) {
			e2.printStackTrace();
		}
	}
}
